<script>
    function findeIndex(Element, Array) {
        length = Array.length
        while (length-- != 0) {
            if (Array[length] == Element)
                return length
        }
        return -1
    }
    alert(findeIndex(0, [1, 2, 3, 0, 4, 5, 6]))
</script>